# Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
# This source file is part of the Cangjie project, licensed under Apache-2.0
# with Runtime Library Exception.
#
# See https://cangjie-lang.cn/pages/LICENSE for license information.

from shared import *

template = '''
/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
 * This source file is part of the Cangjie project, licensed under Apache-2.0
 * with Runtime Library Exception.
 *
 * See https://cangjie-lang.cn/pages/LICENSE for license information.
 */

/*
  @Assertion:   4.15(65) The default strategy is the same with @OverflowThrowing.
  @Description: Checks for {} a, b that compilation fails because of the overflow of a {op} b ({} bound) if
                @OverflowThrowing is used.
  @Mode: compileonly
  @Negative: yes
  @Structure: single
  @CompileWarning: no{}
  @Comment: Auto-generated by gen_compile_error.py
*/

@OverflowThrowing
main() {{
    {} {op} {}
}}
'''
counter = 0

for ty in types:
  ti = type_info[ty]
  for op, oi in operator_info.items():
    for bound in range(2):
      if not ti['signed']:
        if op is '-' and bound: continue
        elif op is not '-' and not bound: continue
      counter += 1
      issue='\n  @Issue: 6265' if counter in [4, 10, 16, 22] else ''
      content = template.format(ty, 'upper' if bound else 'lower', issue, ti[oi[bound][0]], ti[oi[bound][1]], op=op)
      with open(path.format(str(counter).zfill(2)), 'w') as file:
        file.write(content)
       